<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?php echo $title; ?></title>
    <base href="<?php echo base_url(); ?>"/>
    <link href="style/base.css" rel="stylesheet" type="text/css" />
    <link href="style/common.css" rel="stylesheet" type="text/css" />
    <link href="style/houtai.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>

    <script type="text/javascript" src="js/Common.js"></script>
    <script type="text/javascript" src="js/Validation.js"></script>
    <!--[if IE 6]>
    <script type="text/javascript" language="javascript" src="js/ie6/DD_belatedPNG_0.0.8a-min.js"></script>
    <script type="text/javascript" language="javascript">
        DD_belatedPNG.fix('.logo img,.footer_logo img');
    </script>
    <![endif]-->
    <script type="text/javascript">
        $(function(){
            $("#btnSave").bind("click",save);
            $("#txtPwd").bind("blur",check);
            $("#txtPwd1").bind("blur",check);
            $("#txtPwd2").bind("blur",check);
        });
        function save(){
            if(check()==false)
                return;
            var pwd = $.trim($("#txtPwd").val());
            var pwd1 = $.trim($("#txtPwd1").val());
            var params = {
                pwd:pwd,
                pwdnew:pwd1
            };
            $.ajax({
                type:"post",
                url:"index.php/manage/modifyPwd",
                dataType:"json",
                data:params,
                success:function(data){
                    if(data.ReturnCode==1){
                        alert("修改成功,请牢记您的新密码");
                        $("#txtPwd,#txtPwd1,#txtPwd2").val('');
                        ClearError("txtPwd");
                        ClearError("txtPwd1");
                        ClearError("txtPwd2");
                    }else{
                        alert("修改失败,"+data.Msg);
                    }
                }
            });
        }
        function check(){
            var pwd = $.trim($("#txtPwd").val());
            var pwd1 = $.trim($("#txtPwd1").val());
            var pwd2 = $.trim($("#txtPwd2").val());
            if(IsEmpty(pwd)){
                SetError("txtPwd","请输入原密码");
                return false;
            }
            isok=true;
            var params = {pwd:pwd};
            $.ajax({
                type:"post",
                url:"index.php/manage/checkPwd",
                dataType:"json",
                data:params,
                async:false,
                success:function(data){
                    if(data.ReturnCode!=1){
                        isok=false;
                        SetError("txtPwd","原始密码有误");
                    }
                }
            });
            if(isok==false)
                return false;
            SetOK("txtPwd");

            if(IsEmpty(pwd1)){
                SetError("txtPwd1","请输入新密码");
                return false;
            }
            if(pwd==pwd1){
                SetError("txtPwd1","新密码不能和原密码一样");
                return false;
            }
            var len1 = pwd1.length;
            if(len1<6 || len1>20){
                SetError("txtPwd1","密码长度应界于6到20位之间");
                return false;
            }
            SetOK("txtPwd1");
            if(pwd1!=pwd2){
                SetError("txtPwd2","两次输入密码不一致");
                return false;
            }
            SetOK("txtPwd2");
            return true;
        }
    </script>
</head>
<body>
<!-- head S-->
<?php
include 'header.php';
?>
<!-- head E-->

<div class="houtai_content mt_10 clearfix">
    <!-- 侧栏 开始 -->
    <?php
    include 'member_left.php';
    ?>
    <!-- 侧栏 结束 -->

    <!-- 用户中心活动经历 S -->
    <div class="houtai_main">
        <div class="houtai_zhanghugl">
            <div class="houtai_main_tit">用户中心—账户管理</div>
            <div class="houtai_zhanghugl_cnt">
                <form id="formCard" action="index.php/login/uploadImg" method="post"
                      enctype="multipart/form-data">
                <!-- 密码修改 开始 -->
                <div class="mima"><div class="mima_span"><div class="right">原密码</div></div><input name="" id="txtPwd" style="width:200px; height:25px;" type="text" /></div>
                <div class="mima"><div class="mima_span"><div class="right">新密码</div></div><input name="" id="txtPwd1" style="width:200px; height:25px;" type="text" /><span></span></div>
                <div class="mima"><div class="mima_span"><div class="right">再次输入</div></div><input name="" id="txtPwd2" style="width:200px; height:25px;" type="text" /><span></span></div>

                <div class="filter_inp" style="margin-left: 155px;"><img id="btnSave" class="link" src="images/qdxg_inp.jpg" /></div>
                <!-- 密码修改 结束 -->
                </form>
            </div>
        </div>
    </div>
    <!-- 用户中心活动经历 E -->
</div>
<!-- 底部 S -->
<?php
include 'footer.php';
?>
<!-- 底部 E -->
</body>
</html>
